package com.zr.gdms.controller;

import java.io.IOException;
import java.util.Enumeration;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

/**
 * @author  shichongming
 * @E-mail: 
 * @date 创建时间：2017年6月1日 上午11:08:10 
 * @version 1.0 
 * @parameter  
 * @since  
 * @return  
 */

public class SignOutControllerSCM extends HttpServlet{

	//退出系统
	@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
		throws ServletException, IOException {
	// TODO Auto-generated method stub
		doPost(req, resp);}
	
	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		
		req.setCharacterEncoding("UTF-8");
		resp.setCharacterEncoding("UTF-8");
		HttpSession session = req.getSession();
		session.invalidate();		
		Enumeration em = req.getSession().getAttributeNames();
		  while(em.hasMoreElements()){
		   req.getSession().removeAttribute(em.nextElement().toString());
		  }
		  resp.sendRedirect("index.jsp");
	}
}
